package com.wj.rpsm.user.mapper;

import com.github.pagehelper.Page;
import com.wj.rpsm.user.pojo.Amount;
import com.wj.rpsm.user.pojo.vo.UnpaidOwner;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author WeiJin
 * @version 1.0
 */
@Repository
public interface AmountMapper {

    /**
     * 根据id查询用户欠费信息
     * @param id
     * @return
     */
    List<UnpaidOwner> unPaidFee(Integer id);


    /**
     * 根据房间号和费用类型获取账户信息
     * @param id 房间id
     * @param type 费用类型
     * @return
     */
    @Select("select * from amount where amount_roomid = #{id} and amount_type = #{type}")
    Amount getAmountByRoomIdAndType(Integer id,Byte type);

    /**
     * 新增amount
     * @param amount
     * @return
     */
    @Insert("insert into amount value (null,#{amount_roomid},#{amount_type},#{amount_date},#{amount},#{isPaied})")
    Integer insertAmount(Amount amount);

    /**
     * 修改
     * @param amount
     * @return
     */
    Integer updateAmountById(Amount amount);
}
